import type { RouteRecordRaw } from 'vue-router'
const routes: RouteRecordRaw[] = [
    {
        path: '/home',
        component: () => import('@/views/Home/inedx.vue'),
        children: [
            {
                // path: '/home/message', // 全写
                path: 'message', // 简写
                component: () => import('@/views/Message/index.vue'),
                children: [
                    {
                        path: 'msgdetail/:msgId?',// :msgId是站位 ？是可选不可选
                        component: () => import('@/views/MsgDetail/index.vue'),
                        // 1. 配置布尔值
                        // props: true
                        // 2. 配置对象
                        // props: { text: '你是个好人' }
                        // 3. 配置函数
                        props(route) {
                            return {
                                msgId: route.params.msgId,
                                content: route.query.content,
                                text: '地壳变动福哥'
                            }
                        }
                    }
                ]
            },
            {
                path: 'news',
                component: () => import('@/views/News/index.vue'),
                children: [
                    {
                        name: 'NewsDetail',
                        path: 'newsdetail/:newsId?',
                        component: () => import('@/views/NewsDetail/index.vue')
                    }
                ]
            },
            {
                path: '',
                redirect: '/home/message' // vue3中使用的vuerouter4的重定向不能简写
            }
        ]
    },
    {
        path: '/about',
        component: () => import('@/views/About/index.vue')
    },
    {
        path: '/',
        redirect: '/home'
    }
]

export default routes